FROM ubuntu:16.04

# COPY sources.list /etc/apt/sources.list

RUN apt-get update \
    && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends proftpd-mod-mysql mariadb-client-10.0 -y --allow-unauthenticated

RUN groupmod -g 82 www-data \
    && usermod -u 82 -s /bin/false -d /bin/null -c "proftpd user" -g www-data www-data \
    && sed -i "s/# DefaultRoot/DefaultRoot/g" /etc/proftpd/proftpd.conf \
    && sed -i "s/# RequireValidShell/RequireValidShell/g" /etc/proftpd/proftpd.conf \
    && sed -i "s|#Include /etc/proftpd/sql.conf|Include /etc/proftpd/sql.conf|g" /etc/proftpd/proftpd.conf \
    && sed -i "s/#LoadModule mod_sql\.c/LoadModule mod_sql\.c/g" /etc/proftpd/modules.conf \
    && sed -i "s/#LoadModule mod_sql_mysql.c/LoadModule mod_sql_mysql.c/g" /etc/proftpd/modules.conf
    # && sed -i "s/# PassivePorts.*/PassivePorts 60000 65535/g" /etc/proftpd/proftpd.conf

VOLUME /var/www

COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh

CMD ["docker-entrypoint.sh"]
